package edu.wpi.first.wpilibj.templates;

import edu.wpi.first.wpilibj.DigitalModule;
import edu.wpi.first.wpilibj.Victor;

public class Output
{
    //Victors.
    public Victor left;
    public Victor right;
    public Victor launcher;
    public Victor bottom;
    public Victor middle;
    public Victor top;
    public Victor angle;
    public Victor feeder;
    private DigitalModule digiMod;


    public Output() {
        //Constructor for Output. Initialize the two Victors on their odd ports.
        this.left = new Victor(1);
        this.right = new Victor(2);
        this.launcher = new Victor(3);
        this.bottom = new Victor (5);
        this.middle = new Victor (6);
        this.top = new Victor (7);
        this.angle = new Victor (8);
        this.feeder = new Victor (4);
        this.digiMod = DigitalModule.getInstance(1);
    }

    public void setMotors(double left, double right) {
        //Move the motors properly.
        //double rightFixed = right * -1;
        this.left.set(left);
        //this.right.set(rightFixed);
        this.right.set(right);
    }

    public void setLauncher(double l) {
        this.launcher.set(l);
    }
    public double getLauncher(){
        return this.launcher.get();
    }      
    public void setBottom(double l) {
        this.bottom.set(l);
    }
    public double getBottom(){
        return this.bottom.get();
    }
    public void setMiddle(double l) {
        this.middle.set(l);
    }
    public double getMiddle(){
        return this.middle.get();
    }
    public void setTop(double l) {
        this.top.set(l);
    }
    public double getTop(){
        return this.top.get();
    }
    public void setAngle(double l){
        this.angle.set(l);
    }
    public double getAngle(){
        return this.angle.get();
    }
    public void setLight(boolean state) {
        this.digiMod.setRelayForward(1, state);
    }

    public void setRelay(int id, boolean state) {
        this.digiMod.setRelayForward(id, state);
    }
    public void setRelayForward(int id, boolean state) {
        this.digiMod.setRelayForward(id, state);
    }
    public void setRelayReverse(int id, boolean state) {
        this.digiMod.setRelayReverse(id, state);
    }
    public void setFeeder(double l){
        this.feeder.set(l);
    }
    public double getFeeder(){
        return this.feeder.get();
    }

    /**
     * Set ball transportation system motors
     * @param motorVals values to set motors
     *              0) feeder
     *              1) Bottom
     *              2) Mid
     *              3) top
     */
    public void setBallSystem(double[] motorVals) {
        this.feeder.set(motorVals[0]);
        this.bottom.set(motorVals[1]);
        this.middle.set(motorVals[2]);
        this.top.set(motorVals[3]);
    }


}
